﻿import request from '../../../../utils/unirequest';
import type { IPageResponse } from '../../../../type/common';
import type { ISearchResult, IGetResult } from './interface';

interface ISysActivityListApi {
  search(data: {
    Limit: number;
    Page: number;
  }): Promise<IPageResponse<ISearchResult[]>>;

  get(id: string | number): Promise<IGetResult>;
}

function SysActivityListApi(): ISysActivityListApi {
  return {
    // 获取活动列表
    async search(data: {
      Limit: number;
      Page: number;
    }): Promise<IPageResponse<ISearchResult[]>> {
      return await request.post('/api/SysActivityList/Search', data);
    },
    // 获取活动详情
    async get(id: string | number): Promise<IGetResult> {
      return await request.get(`/api/SysActivityList/${id}`);
    },
  };
}

export { SysActivityListApi };
